
import java.io.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author etjheino
 */
public class Result {

    public long concurrentTime = -1;
    public long serialTime = -1;
    public int threadsUsed = -1;
    public int rows1 = -1;
    public int columns1 = -1;
    public int rows2 = -1;
    public int columns2 = -1;
    private PrintWriter out;

    public Result(String filename) throws IOException {
        out = new PrintWriter(new FileWriter(filename));
    }

    public void toFile() {
        if (concurrentTime == -1
//                || serialTime == -1
                || threadsUsed == -1
                || rows1 == -1
                || columns1 == -1
                || rows2 == -1
                || columns2 == -1) {
            throw new IllegalStateException("Result invalid");
        }

        out.println(rows1 + "," + columns1 + "," + rows2 + "," + columns2 + "," + threadsUsed + "," + concurrentTime + "," + serialTime);

        out.flush();
    }

    public void close() {
        out.close();
    }
}
